package model

import (
	"encoding/json"
	"github.com/lib/pq"
)

type FirmwareCreateRequest struct {
	Id          int64         `json:"id"`
	TypeIds     pq.Int64Array `json:"type_ids"`
	Name        string        `json:"name"`
	FileSize    int           `json:"file_size"`
	FilePath    string        `json:"file_path"`
	Description string        `json:"description"`
	Version     string        `json:"version"`
	CreatedAt   int64         `json:"created_at"`
	UpdatedAt   int64         `json:"updated_at"`
}
type FirmwareUpdateRequest struct {
	Id          *int64        `json:"id"`
	TypeIds     pq.Int64Array `json:"type_ids"`
	Name        *string       `json:"name"`
	FileSize    *int          `json:"file_size"`
	FilePath    *string       `json:"file_path"`
	Description *string       `json:"description"`
	Version     *string       `json:"version"`
	CreatedAt   *int64        `json:"created_at"`
	UpdatedAt   *int64        `json:"updated_at"`
}
type FirmwareListRequest struct {
	Id          *int64        `json:"id"`
	Ids         pq.Int64Array `json:"ids"`
	TypeIds     pq.Int64Array `json:"type_ids"`
	Name        *string       `json:"name"`
	FileSize    *int          `json:"file_size"`
	Description *string       `json:"description"`
	Version     *string       `json:"version"`
	CreatedAt   *int64        `json:"created_at"`
	UpdatedAt   *int64        `json:"updated_at"`
	Index       int           `json:"index"`
	Size        int           `json:"size"`
}

type FirmwareListResponse struct {
	Total int                   `json:"total"`
	List  []*FirmwareDetailInfo `json:"list"`
}

type FirmwareInfoRequest struct {
	Id int64 `json:"id"`
}

type FirmwareInfo struct {
	Id          int64         `json:"id"`
	TypeIds     pq.Int64Array `json:"type_ids"`
	Name        string        `json:"name"`
	FileSize    int           `json:"file_size"`
	Description string        `json:"description"`
	Version     string        `json:"version"`
	FilePath    string        `json:"file_path"`
	CreatedAt   int64         `json:"created_at"`
	UpdatedAt   int64         `json:"updated_at"`
}

type FirmwareTypeDetail struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type FirmwareDetailInfo struct {
	Id          int64           `json:"id"`
	Types       json.RawMessage `json:"types"`
	Name        string          `json:"name"`
	FileSize    int             `json:"file_size"`
	Description string          `json:"description"`
	Version     string          `json:"version"`
	FilePath    string          `json:"file_path"`
	CreatedAt   int64           `json:"created_at"`
	UpdatedAt   int64           `json:"updated_at"`
}

type FirmwareDeleteRequest struct {
	Id int64 `json:"id"`
}
